# Name of tgz file to create.
TGZ=ect-$(shell date +%Y-%m-%d-%H%M%S).tgz

.PHONY : all clean ect unit_tests tests distclean

ect:
	cd ect; make

all: ect tests 

clean:
	cd ect && make clean
	cd tests/feature_tests && make clean

tests: feature_tests hcs_tests

feature_tests: ect
	cd tests/feature_tests && make

hcs_tests: ect
	cd tests/hcs_tests/ect2 && make
	cd tests/hcs_tests/ect2extra && make

distclean: clean
	cd ect && make distclean

dist: distclean
	rm -Rf ect-0.3
	mkdir ect-0.3
	mkdir ect-0.3/ect
	mkdir ect-0.3/ect/src
	mkdir ect-0.3/ect/include
	mkdir ect-0.3/ect/ebin
	mkdir ect-0.3/ect/src.erlang
	mkdir -p ect-0.3/tests/feature_tests
	cp README.TXT Makefile ect-0.3
	cp ect/include/* ect-0.3/ect/include
	cp ect/src/*.erl ect-0.3/ect/src
	cp ect/src.erlang/error_handler.erl ect/src.erlang/install.sh ect-0.3/ect/src.erlang
	cp ect/config.hrl ect/ectmake.erl ect/Makefile ect-0.3/ect
	cp tests/feature_tests/*.erl tests/feature_tests/Makefile ect-0.3/tests/feature_tests
	tar cvfz ect-0.3.tgz ect-0.3